
function showProteinTable() {
    $('#proteinTable').css('height', '500px')
                      .css('margin-bottom', '220px');
    $('body').css('min-width','1125px');
}

function setMarker(start, end, max, ranges, label){
    correct = 8
    start=start/correct
    end=end/correct
    max=max/correct
    $(".marker").css('display', 'block')
                .css('top',parseInt(((start-50000)*((ranges*6)/max)))+'px')
                .css('height',parseInt(((end-start)*((ranges*6)/max)))+'px');
    if(label.length>0){
        $('.marker').append('<div class="marked">'+label+'</div>');
    }else{
        $('.marked').remove();
    }
}

function showProteinsInit(){
    var oTable;

    /* Add the events etc before DataTables hides a column */
    $("thead input").keyup( function () {
        /* Filter on the column (the index) of this element */
        oTable.fnFilter( this.value, oTable.oApi._fnVisibleToColumnIndex(
                oTable.fnSettings(), $("thead input").index(this) ) );
    } );

    /*
    * Support functions to provide a little bit of 'user friendlyness' to the textboxes
    */
    $("thead input").each( function (i) {
        this.initVal = this.value;
    } );

    $("thead input").focus( function () {
        if ( this.className == "search_init" )
        {
                this.className = "";
                this.value = "";
        }
    } );

    $("thead input").blur( function (i) {
        if ( this.value == "" )
        {
                this.className = "search_init";
                this.value = this.initVal;
        }
    } );

    oTable = $('#proteinList').dataTable( {
        "sDom": 'RC<"clear">lfrtip',
        "bInfo": false,
        "bPaginate": false,
        "bSortCellsTop": true,
        "sScrollY": "580"
    } );

    $('body').css('min-width',Math.max($('.dataTables_scrollHead').width()+70, 1125));
    var new_position = $('#proteinTable').offset();
    window.scrollTo(0, new_position.top);

    $("input[value='Update']").click(function(){
        $('body').css('min-width', 1125);
        $('.singleChromDescription .text').width($('.content').width()-430);
    });
}

$(document).ready(function() {
    $('.bars').css("width", $("body").width()-160);
    $(window).resize(function() {
         $('.bars').css("width", $("body").width()-160);
    });
});
